#ifndef __HUFFMANTREE_H__
#define __HUFFMANTREE_H__
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

typedef struct HuffmanTreeNode
{
	int val;
	struct HuffmanTreeNode* left;
	struct HuffmanTreeNode* right;
	struct HuffmanTreeNode* parent;
}HTNode;

typedef struct HuffmanTree
{
	HTNode** nodeList;
	int size;
}HTree;

void shellSort(int* num, int numsize);

HTNode* CreateTreeNode(int val);

void HTreeInit(HTree* hTree, int n);

void CreateHTreeNode(HTree* hTree, int* num, int n);

HTNode* CreateHTree(HTree* hTree);

void HTNodeSort(HTNode** nodeList, int size);

void HTreeDestroy(HTree* hTree);

int CalculateHTree(HTNode* root, int height);

#endif